package com.xieyong.leetcode;

public class Leetcode3136 {
    public static void main(String[] args) {
        Leetcode3136 leetcode = new Leetcode3136();
        String word = "234Adas";
        boolean valid = leetcode.isValid(word);
        System.out.println(valid);
    }


    public boolean isValid(String word) {
        int n = word.length();
        if (n < 3) return false;
        boolean flag1 = false, flag2 = false;
        for (int i = 0; i < n; i++) {
            char c = word.charAt(i);
            if (Character.isLetter(c)) {
                char ch = Character.toLowerCase(c);
                if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
                    flag1 = true;
                } else {
                    flag2 = true;
                }
            } else if (!Character.isDigit(c)) {
                return false;
            }
        }
        return flag1 && flag2;
    }
}
